<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
	

	<title>广州电视台G4摇大奖</title>
	<link rel="stylesheet" href="{$_C.hy_path}css/car/main.css">
</head>
<body>
<script type="text/javascript" src="http://zb.weixin.qq.com/nearbycgi/addcontact/BeaconAddContactJsBridge.js">
</script>
  


	<div class="wrapper lj-wrapper" >
		<div class="liangjiang-info page-moveScale delay500">
			<img src="{$_C.hy_path}images/car/cj-ljbg.png" alt="" class="lingjiangbg">
			<p class="lingjiang">{$prize_user.prize_name}</p>
		</div>
		<div class="cj-btn page-moveScale delay1000" onclick="try_card()">
			<a href="#"><img src="{$_C.hy_path}images/car/cj-btn2.png" alt="" class="lingjiangbg"></a>
		</div>
	</div>
	
	
<script src="{$_C.hy_path}/js/zepto.min.js"></script>
{include file="../Common/g4-share-fensi.html"}
		
<script>
		   
		   
		  var prize_user_id = '{$prize_user.id}' 
		   
		 
		  
		  function try_card()
		  {
			
			  var url = "index.php?g=mobile&m=car&a=ajaxCard";

			  var data = {
					  id:prize_user_id
			  };
			 
				$.post(url,data,function(cardlist){
					 wx.addCard({
			              cardList: cardlist,
			              success: function (res) {
			            	  get_card(prize_user_id);  
			              }
			            });
					 
					 
				},"json");
          	  
            	
		  }
		  
		  
		  //领取卡券后异步回调
		  function get_card(id)
		  {
				  
			  var url = "index.php?g=mobile&m=car&a=getCard";
				
			  var data = {
					  id:id
			  }
				$.post(url,data,function(res){
					//showMsg("领取成功。");
					
				//window.location.href="index.php?g=mobile&m=car&a=subscribe&{$ticket}";
					//document.getElementById('mcover').style.display='block';
					
					
					 BeaconAddContactJsBridge.ready(function(){
							//判断是否关注
							
							BeaconAddContactJsBridge.invoke('checkAddContactStatus',{} ,function(apiResult){
								
								if(apiResult.err_code == 0){
									var status = apiResult.data;
									if(status == 1){
										
										
										
										window.location.href="/ws/index.php?g=mobile&m=car&a=lead";
									
									}else{
										
										//跳转到关注页
									  BeaconAddContactJsBridge.invoke('jumpAddContact');
									}
								}else{
									alert(apiResult.err_msg)
								}
							});
					 	}); 
					 
					
				},"text");
          	  
            
		  }
		 
			 
		
		</script>
		
</body>
</html>